package com.vne.skyemart.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.vne.skyemart.dao.CartItemDao;
import com.vne.skyemart.model.CartItem;
import com.vne.skyemart.service.CartItemService;

@Service("cartItemService")
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class CartItemServiceImpl implements CartItemService{
	@Autowired
	private CartItemDao cartItemDao;

	public CartItemDao getCartItemDao() {
		return cartItemDao;
	}

	public void setCartItemDao(CartItemDao cartItemDao) {
		this.cartItemDao = cartItemDao;
	}
	public CartItemServiceImpl() {}
	@Transactional(propagation = Propagation.SUPPORTS,readOnly = false)
	@Override
	public void addCartItem(CartItem cartitem) {
		cartItemDao.save(cartitem);
	}

	@Override
	public List<CartItem> listCartItem() {
		return cartItemDao.findAll();
	}	
}
